package com.cxyd.modules.job.controller;

import com.cxyd.common.page.PageData;
import com.cxyd.common.utils.Result;
import com.cxyd.modules.job.dto.SysJobLogDTO;
import com.cxyd.modules.job.service.SysJobLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/sys/jobLog")
public class SysJobLogController {
    private final SysJobLogService jobLogService;

    public SysJobLogController(SysJobLogService jobLogService) {
        this.jobLogService = jobLogService;
    }

    @GetMapping("page")
    @RequiresPermissions("sys:schedule:log")
    public Result<PageData<SysJobLogDTO>> page(@RequestParam Map<String, Object> params) {
        PageData<SysJobLogDTO> page = jobLogService.page(params);
        return new Result<PageData<SysJobLogDTO>>().ok(page);
    }
}
